<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script>  

	function limpa() {
		var element = document.getElementById('nome');
		element.value = "";
		element.focus();
	}
	
</script>
<title>Membro</title>
</head>
<body>
	
	<form action="<c:url value="/membro"/>" method="post">
		<fieldset>
		<legend>
			<c:choose>
				<c:when test="${not empty membro}">Editar Membro</c:when>
				<c:otherwise>Novo Membro</c:otherwise>
			</c:choose>
		</legend>
			Nome: <input id="nome" type="text" name="membro.nome" value="${membro.nome}"/>
	
			<c:choose>
				<c:when test="${not empty membro}">
					<input type="hidden" name="membro.codigo" value="${membro.codigo}" /> 
					<button type="submit" name="_method" value="PUT">Salvar</button> 
				</c:when>
				<c:otherwise>
					<input type="submit" value="Salvar" />
				</c:otherwise>
			</c:choose>
	
			<input type="button" value="Limpar" onClick="limpa()"/>
			<input type="button" value="Cancelar" onClick="history.go(-1)"/>
		</fieldset>
	</form>

</body>
</html>